package Offer2017;

/**
 * 判断需要改变m的二进制多少位才能得到n
 * Created by 雷文康 on 2017/12/29.
 */
public class Test10b {

    public static void main(String[] args) {
        System.out.println(changeNum(10, 13));
    }

    public static int changeNum(int m, int n){
        int k = (m ^ n);
        int count  = 0;
        while (k != 0){
            count++;
            k = k & (k - 1);
        }
        return count;
    }
}
